<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
        try {
            new Promise((resolve, reject) => {
                throw new Error('自定义错误')
            })
        } catch (err) {
            console.log('try catch 捕获了错误');
        }
    </script>
</body>
</html>